<?php
/**
 * Created by PhpStorm.
 * User: zeopean
 * Date: 2015/8/13
 * Time: 17:31
 */
namespace App\Exceptions;

use Exception;

class ProjectAuthException extends Exception{
    /**
     * NoProjectName            项目名字不存在
     * NoCompanyName            公司名字不存在
     * NoFieldId                投资领域不存在
     * NoPhaseId                投资阶段不存在
     * NoProjectTags            项目标签不存在
     * NoInvet                  融资金额不存在
     * NoSellStock              出让股权不存在
     * NoMinMoney               最小金额不存在
     * NoInvestNum              投资方数量不存在
     * NoPhone                  联系方式不存在
     * NoPlanBook               商业计划书不存在
     * NoProjectLogo            项目logo不存在
     * NoLocation               项目所在的地点不存在
     * NoCreateTime             项目创建时间不存在
     * NoUrl                    项目url不存在
     * NotIsFinance             项目不需要融资
     * NoProjectMilestone       项目里程碑不存在
     * NoUserTeams              项目团队不存在
     * NoUserTeamsLogo          项目团队logo不存在
     */
    /** project_table 项目基本信息  融资需求  商业计划书*/
    const NoProjectName         = 0x01 ;
    const NoCompanyName         = 0x02 ;
    const NoFieldId             = 0x03 ;
    const NoPhaseId             = 0x04 ;
    const NoProjectTags         = 0x05 ;
    const NoInvet               = 0x06 ;
    const NoSellStock           = 0x07 ;
    const NoMinMoney            = 0x08 ;
    const NoInvestNum           = 0x09 ;
    const NoPhone               = 0x10 ;

    const NoPlanBook            = 0x11 ;
    const NoProjectLogo         = 0x12 ;
    const NoLocation            = 0x13 ;
    const NoCreateTime          = 0x14 ;
    const NoUrl                 = 0x15 ;
    const NotIsFinance          = 0x16 ;



    /** project_milestone_table 项目里程碑*/
    const NoProjectMilestone      = 0x17;

    /** user_teams_table 创始团队 */
    const NoUserTeams             = 0x18;
    const NoUserTeamsLogo         = 0x19;

    /** 认证的项目无创建人 */
    const ProjectNotHasUser       = 0x20;
    /** 项目在认证中 */
    const ProjectIsCertification  = 0x21;

    public function __construct($code, array $data = [], Exception $previous = null)
    {
        switch ($code) {
            case self::NoProjectName:
                $message = trans('exception.project_auth.no_project_name');
                break;
            case self::NoCompanyName:
                $message = trans('exception.project_auth.no_company_name');
                break;
            case self::NoFieldId:
                $message = trans('exception.project_auth.no_field');
                break;
            case self::NoPhaseId:
                $message = trans('exception.project_auth.no_phase');
                break;
            case self::NoProjectTags:
                $message = trans('exception.project_auth.no_project_tags');
                break;
            case self::NoInvet:
                $message = trans('exception.project_auth.no_invet');
                break;
            case self::NoSellStock:
                $message = trans('exception.project_auth.no_sell_stock');
                break;
            case self::NoMinMoney:
                $message = trans('exception.project_auth.no_min_money');
                break;
            case self::NoInvestNum:
                $message = trans('exception.project_auth.no_invest_num');
                break;
            case self::NoPhone:
                $message = trans('exception.project_auth.no_phone');
                break;

            case self::NoPlanBook:
                $message = trans('exception.project_auth.no_plan_book');
                break;
            case self::NoProjectLogo:
                $message = trans('exception.project_auth.no_project_logo');
                break;
            case self::NoLocation:
                $message = trans('exception.project_auth.no_project_location');
                break;
            case self::NoCreateTime:
                $message = trans('exception.project_auth.no_project_create_time');
                break;
            case self::NoUrl:
                $message = trans('exception.project_auth.no_url');
                break;
            case self::NoProjectMilestone:
                $message = trans('exception.project_auth.no_project_milestone');
                break;
            case self::NoUserTeams:
                $message = trans('exception.project_auth.no_user_teams');
                break;
            case self::NoUserTeamsLogo:
                $message = trans('exception.project_auth.no_user_teams_logo');
                break;
            case self::NotIsFinance:
                $message = trans('exception.project_auth.not_is_finance');
                break;
            case self::ProjectNotHasUser:
                $message = trans('exception.project_auth.project_not_has_user');
                break;
            case self::ProjectIsCertification:
                $message = trans('exceptions.project_is_certification');
                break;
            default:
                $message = trans('general.unknown_exception');
                break;
        }

        parent::__construct($message, $code, $previous);
    }
}